<?php
include('top.php');
require_once('pasmy/dbwaarden.php');
if(empty($_SESSION['taal'])) {
	session_destroy();
		Header( "HTTP/1.1 301 Moved Permanently" );
		 
		Header( "Location: login.php" ); 
}
echo "<br><br>";

$mysql_id = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($db, $mysql_id);

if(isset($_POST["toevoegen"])) {
	
//postwaarden(); //funktie om de post variabelen te tonen
	
	
	$client = addslashes($_POST["client"]);
	$plaat = addslashes($_POST["plaats"]);
	$straat = addslashes($_POST["straat"]);
	$nr = addslashes($_POST["nr"]);
	$zip = addslashes($_POST["zip"]);
	$tel = addslashes($_POST["tel"]);
	$fax = addslashes($_POST["fax"]);
	$email = addslashes($_POST["email"]);
	$btw = addslashes($_POST["btw"]);
	$banknaam = addslashes($_POST["banknaam"]);
	$reknr = addslashes($_POST["reknr"]);
	$dossier = addslashes($_POST["dossiernr"]);
	$sql = "insert into clienten (client, straat, nr, zip, stad, tel, fax, email, tva, bank, reknr, clientnr) VALUES ('$client', '$straat', '$nr', '$zip', '$plaat', '$tel', '$fax', '$email', '$btw', '$banknaam', '$reknr', '$dossier')";
	//echo "sql = $sql<br>";
	/* hier wordt alles weggeschreven */
	$res = mysql_query($sql, $mysql_id);
	$fout = mysql_errno($mysql_id);
	if ($fout != 0) {
		echo "<font size='+2' color='#FF0000'>" . mysql_errno($mysql_id) . ": " . mysql_error($mysql_id) . "\n" . "</font>";
		mysql_close($mysql_id);
		echo '</body></html>';
		exit;
		}
	
}
else {
?>
<h2><div style="text-align: center"><?php echo $klant[$taal];?></div></h2><br /><br />
<table align="center" width="25%">
<form action="klanttoe.php" method="post">
<tr>
<td><strong><?php echo $klant[$taal];?></strong></td><td><input type="text" name="client" size="25" maxlength="25" /></td>
</tr>
<tr>
<td><strong><?php echo $plaats[$taal];?></strong></td><td><input type="text" name="plaats" size="25" maxlength="25" /></td>
</tr>
<tr>
<td><strong><?php echo $straat[$taal];?></strong></td><td><input type="text" name="straat" size="25" maxlength="25" /></td>
</tr>
<tr>
<td><strong><?php echo $nr[$taal];?></strong></td><td><input type="text" name="nr" size="25" maxlength="25" /></td>
</tr>
<tr>
<td><strong><?php echo $zip[$taal];?></strong></td><td><input type="text" name="zip" size="25" maxlength="25" /></td>
</tr>
<tr>
<td><strong>Tel</strong></td><td><input type="text" name="tel" size="25" maxlength="25" /></td>
</tr>
<tr>
<td><strong>Fax</strong></td><td><input type="text" name="fax" size="25" maxlength="25" /></td>
</tr>
<tr>
<td><strong>E-mail</strong></td><td><input type="text" name="email" size="25" maxlength="25" /></td>
</tr>
<tr>
<td><strong>TVA / BTW</strong></td><td><input type="text" name="btw" size="25" maxlength="25" /></td>
</tr>
<tr>
<td><strong><?php echo $banknaam[$taal];?></strong></td><td><input type="text" name="banknaam" size="25" maxlength="25" /></td>
</tr>
<tr>
<td><strong><?php echo $reknr[$taal];?></strong></td><td><input type="text" name="reknr" size="25" maxlength="25" /></td>
</tr>
<tr>
<td><strong><?php echo $clientnr[$taal];?></strong></td><td><input type="text" name="dossiernr" size="25" maxlength="25" /></td>
</tr>




<tr><td colspan="2">&nbsp;</td></tr>
<tr><td colspan="2"><div style="text-align: center"><input type="submit" name="toevoegen" value="<?php echo $toevoegen[$taal];?>" /></div></td></tr>
</form>
</table>



<?php
}
include('footer.php');
?>